/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ms.jasim.model.util;

import java.util.List;

import ms.jasim.framework.IValueProvider;
import ms.jasim.model.*;
import ms.jasim.model.items.ActorItem;
import ms.jasim.model.items.GoalItem;
import ms.jasim.model.items.IntItem;
import ms.jasim.model.items.Item;
import ms.jasim.model.items.ItemList;
import ms.jasim.model.items.TextItem;
import ms.utils.IModelObjectList;
import ms.utils.INamedItem;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance
 * hierarchy. It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object and proceeding up the
 * inheritance hierarchy until a non-null result is returned, which is the
 * result of the switch. <!-- end-user-doc -->
 * @see ms.jasim.model.ModelPackage
 * @generated
 */
public class ModelSwitch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	protected static ModelPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc --> <!--
	 * end-user-doc -->
	 * @generated
	 */
	public ModelSwitch() {
		if (modelPackage == null) {
			modelPackage = ModelPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc --> <!--
	 * end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc --> <!--
	 * end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc --> <!--
	 * end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case ModelPackage.MODEL_OBJECT: {
				ModelObject modelObject = (ModelObject)theEObject;
				T result = caseModelObject(modelObject);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.NAMED_MODEL_OBJECT: {
				NamedModelObject namedModelObject = (NamedModelObject)theEObject;
				T result = caseNamedModelObject(namedModelObject);
				if (result == null) result = caseModelObject(namedModelObject);
				if (result == null) result = caseINamedItem(namedModelObject);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.JASIM_MODEL: {
				JasimModel jasimModel = (JasimModel)theEObject;
				T result = caseJasimModel(jasimModel);
				if (result == null) result = caseModelObject(jasimModel);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.JASIM_TEMPLATE: {
				JasimTemplate jasimTemplate = (JasimTemplate)theEObject;
				T result = caseJasimTemplate(jasimTemplate);
				if (result == null) result = caseNamedModelObject(jasimTemplate);
				if (result == null) result = caseModelObject(jasimTemplate);
				if (result == null) result = caseINamedItem(jasimTemplate);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.CUSTOMIZABLE_OBJECT: {
				CustomizableObject customizableObject = (CustomizableObject)theEObject;
				T result = caseCustomizableObject(customizableObject);
				if (result == null) result = caseNamedModelObject(customizableObject);
				if (result == null) result = caseModelObject(customizableObject);
				if (result == null) result = caseINamedItem(customizableObject);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.ACTOR: {
				Actor actor = (Actor)theEObject;
				T result = caseActor(actor);
				if (result == null) result = caseCustomizableObject(actor);
				if (result == null) result = caseNamedModelObject(actor);
				if (result == null) result = caseModelObject(actor);
				if (result == null) result = caseINamedItem(actor);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.GOAL: {
				Goal goal = (Goal)theEObject;
				T result = caseGoal(goal);
				if (result == null) result = caseCustomizableObject(goal);
				if (result == null) result = caseNamedModelObject(goal);
				if (result == null) result = caseModelObject(goal);
				if (result == null) result = caseINamedItem(goal);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.GOAL_REQUEST: {
				GoalRequest goalRequest = (GoalRequest)theEObject;
				T result = caseGoalRequest(goalRequest);
				if (result == null) result = caseModelObject(goalRequest);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.DEPENDENCY: {
				Dependency dependency = (Dependency)theEObject;
				T result = caseDependency(dependency);
				if (result == null) result = caseModelObject(dependency);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.DECOMPOSITION: {
				Decomposition decomposition = (Decomposition)theEObject;
				T result = caseDecomposition(decomposition);
				if (result == null) result = caseModelObject(decomposition);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.CAPABILITY: {
				Capability capability = (Capability)theEObject;
				T result = caseCapability(capability);
				if (result == null) result = caseCustomizableObject(capability);
				if (result == null) result = caseNamedModelObject(capability);
				if (result == null) result = caseModelObject(capability);
				if (result == null) result = caseINamedItem(capability);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.EVALUATOR_LIST: {
				EvaluatorList evaluatorList = (EvaluatorList)theEObject;
				T result = caseEvaluatorList(evaluatorList);
				if (result == null) result = caseIEvaluatorList(evaluatorList);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.EVALUATOR: {
				Evaluator evaluator = (Evaluator)theEObject;
				T result = caseEvaluator(evaluator);
				if (result == null) result = caseNamedModelObject(evaluator);
				if (result == null) result = caseModelObject(evaluator);
				if (result == null) result = caseINamedItem(evaluator);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.ACTOR_LIST: {
				ActorList actorList = (ActorList)theEObject;
				T result = caseActorList(actorList);
				if (result == null) result = caseIActorList(actorList);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ModelPackage.GOAL_LIST: {
				GoalList goalList = (GoalList)theEObject;
				T result = caseGoalList(goalList);
				if (result == null) result = caseIGoalList(goalList);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Object</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Object</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseModelObject(ModelObject object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Named Model Object</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Named Model Object</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseNamedModelObject(NamedModelObject object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Jasim Model</em>'.
	 * <!-- begin-user-doc --> This implementation
	 * returns null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Jasim Model</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseJasimModel(JasimModel object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Jasim Template</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Jasim Template</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseJasimTemplate(JasimTemplate object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Customizable Object</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Customizable Object</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCustomizableObject(CustomizableObject object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Actor</em>'.
	 * <!-- begin-user-doc --> This implementation returns
	 * null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Actor</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseActor(Actor object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '
	 * <em>Goal</em>'. <!-- begin-user-doc --> This implementation returns null;
	 * returning a non-null result will terminate the switch. <!-- end-user-doc
	 * -->
	 * 
	 * @param object
	 *            the target of the switch.
	 * @return the result of interpreting the object as an instance of '
	 *         <em>Goal</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseGoal(Goal object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Goal Request</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Goal Request</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseGoalRequest(GoalRequest object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Dependency</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Dependency</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseDependency(Dependency object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Decomposition</em>'.
	 * <!-- begin-user-doc --> This implementation
	 * returns null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Decomposition</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseDecomposition(Decomposition object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Capability</em>'.
	 * <!-- begin-user-doc --> This implementation returns
	 * null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Capability</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCapability(Capability object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Evaluator</em>'.
	 * <!-- begin-user-doc --> This implementation returns
	 * null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Evaluator</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEvaluator(Evaluator object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Actor List</em>'.
	 * <!-- begin-user-doc --> This implementation returns
	 * null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Actor List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseActorList(ActorList object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Goal List</em>'.
	 * <!-- begin-user-doc --> This implementation returns
	 * null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Goal List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseGoalList(GoalList object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Evaluator List</em>'.
	 * <!-- begin-user-doc --> This implementation
	 * returns null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Evaluator List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEvaluatorList(EvaluatorList object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>IActor List</em>'.
	 * <!-- begin-user-doc --> This implementation
	 * returns null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>IActor List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIActorList(IModelObjectList<Actor> object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>IGoal List</em>'.
	 * <!-- begin-user-doc --> This implementation returns
	 * null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>IGoal List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIGoalList(IModelObjectList<Goal> object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>IItem List</em>'.
	 * <!-- begin-user-doc --> This implementation returns
	 * null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>IItem List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIItemList(IModelObjectList<Item> object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>IEvaluator List</em>'.
	 * <!-- begin-user-doc --> This implementation
	 * returns null; returning a non-null result will terminate the switch. <!--
	 * end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>IEvaluator List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIEvaluatorList(IModelObjectList<Evaluator> object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>INamed Item</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>INamed Item</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseINamedItem(INamedItem object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>IValue Provider</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>IValue Provider</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIValueProvider(IValueProvider object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc --> This implementation returns
	 * null; returning a non-null result will terminate the switch, but this is
	 * the last case anyway. <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //ModelSwitch
